﻿using Microsoft.Practices.Unity;
using StockholmsStad.Windows.UI.Infrastructure.Interfaces;
using StockholmsStad.Windows.UI.Modules.Couple.Interfaces;
using StockholmsStad.Windows.UI.Modules.Couple.Models;
using StockholmsStad.Windows.UI.Facade;

namespace StockholmsStad.Windows.UI.Modules.Couple.Services
{
    public class HistoryService : IHistoryService
    {
        private IApplicationService applicationService;

        [Dependency]
        public IApplicationService ApplicationService
        {
            set { applicationService = value; }
        }

        #region IHistoryService Members

        public HistoryPresentationModel GetHistory(int ticketId)
        {
            var model = new HistoryPresentationModel();

            if (ticketId > 0)
            {
                var user = applicationService.GetCurrentUser();
                var facade = new TicketFacade(user);
                var historyItems = facade.GetHistory(ticketId);
                model.History = historyItems;

            }

            return model;
        }

        #endregion
    }
}
